import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { TableColumn } from '@/types/table'
// 表单校验
export const rules = reactive({
                        paperid: [{ required: true, message: '试卷ID不能为空', trigger: 'blur' }],
                        testid: [{ required: true, message: '试题ID不能为空', trigger: 'blur' }],
                        testType: [{ required: true, message: '题型类型不能为空', trigger: 'blur' }]
})
//复杂配置参照文档修改
const crudSchemas = reactive<CrudSchema[]>([
  {
    label: 'ID',
    field: 'id',
    isSearch:  false ,
	isColumnHidden:  false 
  },
  // {
  //   label: '试卷ID',
  //   field: 'paperid',
  //   isSearch:  true ,
	// isColumnHidden:  false ,
	// search: {
  //     componentProps: {
  //       style: {
  //         width: '240px'
  //       }
  //     }
  //   }
  // },
  {
    label: '试题标题',
    field: 'title',
    isSearch:  true ,
	isColumnHidden:  false ,
	search: {
      componentProps: {
        style: {
          width: '240px'
        }
      }
    }
  },
  {
    label: '题型类型',
    field: 'testType',
    isSearch:  true ,
	isColumnHidden:  false ,
	dictType: DICT_TYPE.EXAM_TEST_TYPE,
	dictClass: 'number',
	search: {
      componentProps: {
        style: {
          width: '240px'
        }
      }
    }
  },
  {
    label: '创建者',
    field: 'creator',
    isSearch:  false ,
	isColumnHidden:  true 
  },
  {
    label: '创建时间',
    field: 'createTime',
    isSearch:  true ,
	isColumnHidden:  false ,
	formatter: dateFormatter,
	search: {
		component: 'DatePicker',
      componentProps: {
		  valueFormat: 'YYYY-MM-DD HH:mm:ss',
        style: {
          width: '240px'
        }
      }
    }
  },
  {
    label: '更新者',
    field: 'updater',
    isSearch:  false ,
	isColumnHidden:  true 
  },
  {
    label: '更新时间',
    field: 'updateTime',
    isSearch:  false ,
	isColumnHidden:  true ,
	formatter: dateFormatter
  },
  {
    label: '操作',
    field: 'action',
    isForm: false
  }
])
export const { allSchemas } = useCrudSchemas(crudSchemas)
